Skip to content

feat(aws-serverless)!: Use GenAI span ops for Bedrock inference - #22761

Closed
msonnb wants to merge 1 commit into
developfrom
ms/bedrock-ops
Closed

feat(aws-serverless)!: Use GenAI span ops for Bedrock inference#22761
msonnb wants to merge 1 commit into
developfrom
ms/bedrock-ops

Conversation

@msonnb

@msonnb msonnb commented Jul 28, 2026

Copy link
Copy Markdown
Member

Use chat for Bedrock Converse spans and generate_content for InvokeModel spans instead of generic rpc, so inference calls are classified by their GenAI operation.

Part of #22446

Co-Authored-By: GPT-5.6 Codex <codex@openai.com>
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.85 kB - -
@sentry/browser - with treeshaking flags 28.05 kB - -
@sentry/browser (incl. Tracing) 47.42 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.43 kB - -
@sentry/browser (incl. Tracing, Profiling) 52.16 kB - -
@sentry/browser (incl. Tracing, Replay) 86.74 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.16 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 91.48 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 104.11 kB - -
@sentry/browser (incl. Feedback) 47.16 kB - -
@sentry/browser (incl. sendFeedback) 34.69 kB - -
@sentry/browser (incl. FeedbackAsync) 39.78 kB - -
@sentry/browser (incl. Metrics) 30.92 kB - -
@sentry/browser (incl. Logs) 31.14 kB - -
@sentry/browser (incl. Metrics & Logs) 31.83 kB - -
@sentry/react 31.64 kB - -
@sentry/react (incl. Tracing) 49.64 kB - -
@sentry/vue 34.77 kB - -
@sentry/vue (incl. Tracing) 49.37 kB - -
@sentry/svelte 29.88 kB - -
CDN Bundle 31.89 kB - -
CDN Bundle (incl. Tracing) 47.76 kB - -
CDN Bundle (incl. Logs, Metrics) 33.44 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.14 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.8 kB - -
CDN Bundle (incl. Tracing, Replay) 85.4 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.68 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.47 kB - -
CDN Bundle - uncompressed 95.12 kB - -
CDN Bundle (incl. Tracing) - uncompressed 143.26 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.83 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.25 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.6 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.52 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.49 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.18 kB - -
@sentry/nextjs (client) 52.23 kB - -
@sentry/sveltekit (client) 47.84 kB - -
@sentry/core/server 79.73 kB - -
@sentry/core/browser 51.61 kB - -
@sentry/node 122.35 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B - -
@sentry/node - without tracing 85.75 kB - -
@sentry/aws-serverless 93.81 kB +0.04% +33 B 🔺
@sentry/cloudflare (withSentry) - minified 197.24 kB - -
@sentry/cloudflare (withSentry) 485.21 kB - -

View base workflow run

@msonnb
msonnb marked this pull request as ready for review July 28, 2026 13:58
@msonnb
msonnb requested review from a team as code owners July 28, 2026 13:58
@msonnb
msonnb requested review from andreiborza and isaacs and removed request for a team July 28, 2026 13:58

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 36653f4. Configure here.

const spanAttributes: Attributes = {
// oxlint-disable-next-line typescript/no-deprecated
[GEN_AI_SYSTEM]: GEN_AI_SYSTEM_VALUE_AWS_BEDROCK,
[SENTRY_OP]: GEN_AI_GENERATE_CONTENT_SPAN_OP,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GenAI span ops missing prefix

High Severity

Bedrock spans set sentry.op to bare chat / generate_content, but every other GenAI integration in this SDK uses gen_ai.chat / gen_ai.generate_content. Core GenAI handling (extractGenAiSpansFromEvent, hasGenAiSpans, conversation ID attachment) keys off the gen_ai. prefix, so these inference spans stay misclassified and miss GenAI-specific processing.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 36653f4. Configure here.

@msonnb
msonnb marked this pull request as draft July 28, 2026 14:08
@msonnb msonnb closed this Jul 28, 2026
Comment on lines 22 to +43
@@ -39,6 +40,7 @@ function assertBedrockSpans(transaction: TransactionEvent): void {
// InvokeModel (non-streaming, anthropic.claude request/response body)
expect(spans, 'expected a Bedrock InvokeModel span').toContainEqual(
expect.objectContaining({
op: 'generate_content',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: Hm, we typically prefix these with gen_ai., I don't know enough about bedrock but maybe we can align here with the other ai instrumentations?

[key: string]: any;
}

const GEN_AI_GENERATE_CONTENT_SPAN_OP = 'generate_content';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: Do we have a task to add this to sentry conventions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants